$('.sidebar .menu_manage a').each(function(index, value) {
	switch (index) {
	case 0:
		$(this).attr('href', ctx + '/h/front-19.html');
		break;
	case 1:
		$(this).attr('href', ctx + '/h/front-18.html');
		break;
	case 2:
		$(this).attr('href', ctx + '/h/front-23.html');
		break;
	case 3:
		$(this).attr('href', ctx + '/h/front-21.html');
		break;
	}
	;
});

$('.sidebar .menu_public a').each(function(index, value) {
	switch (index) {
	case 0:
		$(this).attr('href', ctx + '/h/front-26.html');
		break;
	case 1:
		$(this).attr('href', ctx + '/h/front-25.html');
		break;
	case 2:
		$(this).attr('href', ctx + '/h/front-24.html');
		break;
	}
	;
});

$('.sidebar .main .bar a').each(function(index, value) {
	switch (index) {
	case 0:
		$(this).attr('href', ctx + '/h/front-17.html');
		break;
	case 1:
		$(this).attr('href', ctx + '/h/front-26.html');
		break;
	case 2:
		$(this).attr('href', ctx + '/h/front-20.html');
		break;
	case 3:
		$(this).attr('href', ctx + '/h/front-19.html');
		break;
	case 4:
		$(this).attr('href', ctx + '/h/front-22.html');
		break;
	}
});

$('.sidebar .menu_info a:first').attr('href', ctx + '/h/front-22.html');

$('.sidebar .menu_info a:last').attr('href', ctx + '/h/front-27.html');

function addOne(selector) {
	return Number($(selector).text()) + 1;
}

function desOne(selector) {
	return Number($(selector).text()) - 1;
}

$(".paging ul li:first").click(function() {
	if (Number($(this).next().text()) > 1) {
		$(".paging ul li:lt(6):gt(0)").each(function(index, ele) {
			$(this).find("span").text(desOne(this));
		});
	}
});

$(".paging ul li:last").click(function() {
	$(".paging ul li:lt(6):gt(0)").each(function(index, ele) {
		$(this).find("span").text(addOne(this));
	});
});

$(".paging span input:last").hover(function() {
	$(this).addClass("active");
}, function() {
	$(this).last().removeAttr("class");
});

function setCursorStyle(selector, style01, style02) {
	if (style02 != undefined) {
		$(selector).hover(function() {
			$(this).addClass(style01);
		}, function() {
			$(this).last().removeClass(style01).addClass(style02);
		});
	} else {
		$(selector).hover(function() {
			$(this).addClass(style01);
		}, function() {
			$(this).last().removeAttr("class");
		});
	}
}

function selOrCalLabel(selector, cls) {
	$(selector).click(function() {
		$(this).toggleClass(cls);
	});
}

function zzLoad() {
	$('body > div.main > div.ownCom > div > div > a:first').click(function() {
		window.location.href = "front-26.html";
	})
	$('body > div.main > div.ownCom > div > div > a:last').click(function() {
		window.location.href = "front-31.html";
	})
	otherCloseValue(".sidebar .main .wrap .tab a", "selected");
}

function syLoad() {
	$('body > div.main > div.ownCom > div > div > a:first').click(function() {
		window.location.href = "front-30.html";
	})
	$('body > div.main > div.ownCom > div > div > a:last').click(function() {
		window.location.href = "front-32.html";
	})
	otherCloseValue("body > div.main > div.ownCom > div > div > a", "selected");
}

var divStr = '<div style="clear:both;display:none;background-color:#2A2C32;color: #ABAEBE;font-size: 18px;padding:3px 5px 3px 5px;width: 110px;text-align: center;border-radius:5px"><span style="cursor:pointer;width:100%;display:block;border-radius:3px">注销</span><a style="font-size:18px;width:100%;display:block;border-radius:3px;color:#ABAEBE;text-decoration: none" href="'
		+ ctx + '"+"/h/front-19.html">设置</a>';

function sprentLoad() {
	$(
			"body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(2) > td:nth-child(2) span:nth-child(1)")
			.click(function() {
				window.location.href = "front-30.html";
			});
	$(
			"body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(2) > td:nth-child(2) span:nth-child(2)")
			.click(function() {
				window.location.href = "front-34.html";
			});
}

function spsellLoad() {
	$(
			"body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(2) > td:nth-child(2) span:nth-child(1)")
			.click(function() {
				window.location.href = "front-32.html";
			});
	$(
			"body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(2) > td:nth-child(2) span:nth-child(2)")
			.click(function() {
				window.location.href = "front-33.html";
			});
}

function zzRentLoad() {
	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > span:nth-child(1)')
			.click(function() {
				window.location.href = "front-26.html";
			});

	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > span:nth-child(2)')
			.click(function() {
				window.location.href = "front-30.html";
			});
}

function zzSellLoad() {
	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > span:nth-child(1)')
			.click(function() {
				window.location.href = "front-31.html";
			});

	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > span:nth-child(2)')
			.click(function() {
				window.location.href = "front-32.html";
			});
}

function clearSelect2() {
	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(2)')
			.empty().append($('<option>片区</option>'));
	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(3)')
			.empty().append($('<option>小区</option>'));
}

function loadAreaData() {
	var commonUrl = getUrl();
	var xingzhengquUrl = commonUrl + "a/c/getAreaList";
	var shangquUrl = commonUrl + "a/c/getShangquanList";
	var xiaoquUrl = commonUrl + "a/c/getXiaoQu";
	loadRemoteData(
			xingzhengquUrl,
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(1)',
			loadOptionLabelById);
	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(1)')
			.change(
					function() {
						clearSelect2();
						var parentId = $(this).children("option:selected")
								.val();
						if (parentId != "行政区") {
							var params = {
								"parentId" : parentId
							};
							$
									.post(
											shangquUrl,
											params,
											function(data) {
												loadOption(
														'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(2)',
														data.data);
											});
						}
					});

	$(
			'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(2)')
			.change(
					function() {
						$(
								'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(3)')
								.empty().append($('<option>小区</option>'));
						var parentId = $(this).children("option:selected")
								.val();
						if (parentId != "片区") {
							var params = {
								"parentId" : parentId
							};
							$
									.post(
											xiaoquUrl,
											params,
											function(data) {
												loadOption(
														'body > div.main > div.ownCom > div > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > select:nth-child(3)',
														data.data);
											});
						}
					});
}

function listrentClick() {
	$('body > div.main > div.wrap > ul > li > div.li_middle > div.img').click(
			function() {
				var id = $(this).parent().parent().find('div[id]').attr("id");
				var typeId = $(this).find("span[id]").attr("id");
				switch (typeId) {
				case "1":
				case "2":
					window.location.href = "front-26.html?id=" + id;
					break;
				case "3":
					window.location.href = "front-30.html?id=" + id;
					break;
				case "4":
					window.location.href = "front-34.html?id=" + id;
					break;
				}
			});
}

function listsellClick() {
	$('body > div.main > div.wrap > ul > li > div.li_middle > div.img').click(
			function() {
				var id = $(this).parent().parent().find('div[id]').attr("id");
				var typeId = $(this).find("span[id]").attr("id");
				switch (typeId) {
				case "1":
				case "2":
					window.location.href = "front-31.html?id=" + id;
					break;
				case "3":
					window.location.href = "front-32.html?id=" + id;
					break;
				case "4":
					window.location.href = "front-33.html?id=" + id;
					break;
				}
			});
}

setCursorStyle('body > div.main > div.wrap > ul > li > div[id]', "active",
		"li_right");